package com.pro.service.imple;

import com.google.gson.Gson;
import com.pro.mapper.JsTransactionStatisticsMapper;
import com.pro.pojo.JsCourse;
import com.pro.pojo.JsProduct;
import com.pro.service.JsTransactionStatisticsService;
import com.pro.utils.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsTransactionStatisticsServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2021/12/7 18:38
 * @Author: XJR
 */
@Service
public class JsTransactionStatisticsServiceImple implements JsTransactionStatisticsService {
    @Autowired
    private JsTransactionStatisticsMapper mapper;

    @Autowired
    private RedisCache redisCache;

    private Gson gson = new Gson();

    ///查看商品订单
    public List<JsProduct> selectGoodsStatistics(){
        List<JsProduct> jsProducts = mapper.selectGoodsStatistics();
        redisCache.setCacheObject("selectGoodsStatistics",gson.toJson(jsProducts));
        return jsProducts;
    };
    //查看课程订单
    public List<JsCourse> selectCurriculumStatistics(){
        List<JsCourse> jsCourses = mapper.selectCurriculumStatistics();
        redisCache.setCacheObject("selectCurriculumStatistics",gson.toJson(jsCourses));
        return jsCourses;
    };
}
